var obj = {};
$.ajax({url:'/platform/menu/adminMenu',dataType:'JSON',async:false,success:function (data) {
    obj.data=data.menuTree;
    window.permissions = data.permissions;}
});

var menuItem = Vue.extend({
    name:'menu-item',
    props: {item:{}},
    template: [
        '<li v-if="item.list !=0">',
        '<a href="javascript:;" class="">',
        '<i :class="item.menuIcon"></i>',
        '<span class="nav-label">{{item.menuName}}</span>',
        '<span class="fa arrow"></span>',
        '</a>',
        '<ul class="nav nav-second-level adminTree">',
        '<menu-item :item="item" v-for="item in item.list"></menu-item>',
        '</ul>',
        '</li>',
        '<li v-else>',
        '<a :href="item.menuUrl" class="J_menuItem">',
        '<i :class="item.menuIcon"></i>',
        '<span class="nav-label">{{item.menuName}}</span>',
        '</a>',
        '</li>'].join('')});
Vue.component('menuItem',menuItem);
var vm = new Vue({
    el: '#side-menu',
    data: {

        admin:{},
        adminMenu:obj.data
    },
    methods:{
        getAdmin:function(){
            $.getJSON("/platform/admin/info?_"+$.now(),function (data) {
                vm.admin = data.admin;
            });
        }
    },
    created:function () {
        this.getAdmin();
    }

});